-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update python locators docs #1903
base: trunk
Are you sure you want to change the base?
Update python locators docs #1903
Conversation
✅ Deploy Preview for selenium-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
Could I get a review please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution @pmartinez1 ! A few changes must be made before it can be properly reviewed:
pytest import is unnecessary, pytest will not run a function if it is not prefixed by test unless explicitly called in a test function. Line 70 can be removed as well
Thanks for pointing that out. I've updated the PR. |
Sorry about that, honestly forgot the relative locator section was included in this pr. I only did a cursory look through this commit's changes and commented when I saw you added an import for pytest. Could you expand the relative locator section to have an individual test for each relative locator (above, below, rightof, leftof, and near)? Once that's done I'll test it locally |
No problem. And yes, will split them up. |
Add examples to the python docs for locators
Split the tests for relative locators and used a live page for the tests.
4984152
to
9ccc041
Compare
I ended updating them a bit more. Originally, I had created the test not to run, but follow along with the static image that is present, but I think your approach is better. I borrowed a little from your PR (for the sake of expediency) and now the tests are ready to be run. |
Use what's available, I don't mind. I'll pull the branch for test |
Tested changes locally and looks good. The goal is to move all the code examples to executable files in the repo, so eventually this whole section on relative locators will eventually be refactored to no longer refer to that image. What do you think about this PR? @harsha509 |
Hi @harsha509, Would you be able to give this a review? @shbenzer has already given it one pass. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @pmartinez1 !
Wow. Again tests are failing on my PR :( For some reason, the "test_find_by_link_text" test is failing on Windows only, but seems to be deterministic. Does anyone have a Windows machine they can test on? Any ideas? I can't think of a reason why it fails there or at all. The test is simply going to the Selenium and looking for "Documentation". It passes in every other environment and a similar test, "test_find_by_partial_link_text" passes with no issue everywhere. I could add waits to see if it is a timing/loading issue? I haven't gotten around to finding an option for testing Windows yet, but it is on my list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmartinez1 Code in your PR LGTM.
Please investigate and fix failed tests.
Sorry for the super long delay. I am back and looking into this today. Will update as soon as I figure out the cause. |
User description
Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.
Description
This PR moves the code to the test_locators.py file in the python/tests directory.
Motivation and Context
Helps the code be more organized, instead of having stand alone code that has not been tested.
Types of changes
Checklist
PR Type
Tests, Documentation
Description
Changes walkthrough 📝
test_locators.py
Add test cases for various Selenium locators in Python
examples/python/tests/elements/test_locators.py
partial link text, tag name, and XPath.
locators.en.md
Update Python locator examples to reference test file
website_and_docs/content/documentation/webdriver/elements/locators.en.md
locators.ja.md
Update Python locator examples to reference test file
website_and_docs/content/documentation/webdriver/elements/locators.ja.md
locators.pt-br.md
Update Python locator examples to reference test file
website_and_docs/content/documentation/webdriver/elements/locators.pt-br.md
locators.zh-cn.md
Update Python locator examples to reference test file
website_and_docs/content/documentation/webdriver/elements/locators.zh-cn.md